<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数据类型转换</title>
</head>

<body>
    <script>
        //数字转字符串
        // let x = ("The answer is " + 20);
        // console.log(x);
        // let y = (20 + "is the answer");
        // console.log(y);
        // console.log("37" - 7);
        // console.log("37" + 7);
        // let a = 50;
        // a = a + "";
        // console.log(a);
        // let b = "60";
        // b = b - 0;
        // console.log(b);
        //字符转数字
        let str = "1.5";
        console.log(parseInt(str));
        str = "10.1";
        console.log(parseFloat(str));
        let x = "1.1";
        console.log(x + x);
        console.log((+x) + (+x));
    </script>
</body>

</html>